package controllers;

import java.util.List;

import models.House;
import models.Person;

import play.db.jpa.JPASupport;
import play.mvc.*;

public class Application extends Controller {

    public static void index() {
		List<House> homes = House.all().fetch();
		List<Person> people = Person.all().fetch();
		render(homes, people);
    }


	public static void addPerson( Long houseId, String name )
	{
		Person p = new Person();
		p.name = name;
		p.house = ( House ) House.findById( houseId );
		p.save();
		index();
	}

	public static void addHouse( String address )
	{
		House h = new House();
		h.address = address; // GUY - don't save a person here
		h.save();
		index();
	}


}